##全局变量
version=$1
#--------------------------------#
inspath=/home/sunqian
cpu_num=`grep -c "processor" /proc/cpuinfo`; #CPU核数
ip_addr=`ifconfig|grep inet|awk '{print $2}'|awk 'NR==1'` #ip地址
osType=`cat /etc/os-release|grep ID |awk NR==1|awk -F \" '{print $2}'`
basearch=`arch`
#--------------------------------#
#grub 添加参数 nohz=on audit=0 sched_steal_node_limit=4 scsi_mod.use_blk_mq=y

#nohz=on
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 nohz=on\"/g" /etc/default/grub

#nosoftlockup
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 nosoftlockup\"/g" /etc/default/grub

#processor.max_cstate=0
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 processor.max_cstate=0\"/g" /etc/default/grub

#nmi_watchdog=0
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 nmi_watchdog=0\"/g" /etc/default/grub

#idle=pol
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 idle=pol\"/g" /etc/default/grub

#kpti=off
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 kpti=off\"/g" /etc/default/grub

#cpuidle.off=1
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 cpuidle.off=1\"/g" /etc/default/grub

#skew_tick=1
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 skew_tick=1\"/g" /etc/default/grub

#audit=0
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 audit=0\"/g" /etc/default/grub

#scsi_mod.use_blk_mq=y
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 scsi_mod.use_blk_mq=y\"/g" /etc/default/grub

#sched_steal_node_limit=4
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 sched_steal_node_limit=4\"/g" /etc/default/grub

#ssbd=force-off
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 ssbd=force-off\"/g" /etc/default/grub

#cgroup_disable=files
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 cgroup_disable=files\"/g" /etc/default/grub

#pci=pcie_bus_perf
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 pci=pcie_bus_perf\"/g" /etc/default/grub

#iommu.passthrough=1
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 iommu.passthrough=1\"/g" /etc/default/grub



#关闭熔断补丁
sed -i "s/\(GRUB_CMDLINE_LINUX.*\)\"/\1 noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off
\"/g" /etc/default/grub


grub2-mkconfig -o /boot/efi/EFI/$osType/grub.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg

reboot;